%option noyywrap

%{
#include <stdlib.h> 
#include <stdio.h> 

void yyerror(char*); 
extern int yylval; 

%}

DIGIT	[0-9]
ID		[_A-Z][_A-Z0-9]

%x COMMENT

%%
 /* Remove comments */

"//"[^\n]*"\n"	;
^"'"[^\n]*"\n"	;
^"%"[^\n]*"\n"	;
"/*"			{BEGIN COMMENT;}
<COMMENT>.|\n	;
<COMMENT>"*/"	{BEGIN 0;}

{DIGIT}+	{BeginToken(yytext); yylval.value = atoi(yytext); return VALUE;}

"\r\n"		{BeginToken(yytext); return NEWLINE;}
(=|:=){1}	{BeginToken(yytext); return LASSIGN;}
"=>"		{BeginToken(yytext); return RASSIGN;}
[=]{1,2}	{BeginToken(yytext); return EQUALS;}
"!="		|
"<>"		|
"isn't"		|
"is not"	{BeginToken(yytext); return NOTEQUAL;}
"=~"		{BeginToken(yytext); return ABOUTEQUAL;}
"<="		{BeginToken(yytext); return LTE;}
">="		{BeginToken(yytext); return GTE;}
"+"			{BeginToken(yytext); return PLUS;}
"-"			{BeginToken(yytext); return MINUS;}
"*"			{BeginToken(yytext); return TIMES;}
"/"			{BeginToken(yytext); return DIVIDE;}
"("			{BeginToken(yytext); return LPAREN;}
")"			{BeginToken(yytext); return RPAREN;}
"."			{BeginToken(yytext); return DOT;}
";"			{BeginToken(yytext); return SEMICOLON;}

"if"		{BeginToken(yytext); return IF;}
"then"		{BeginToken(yytext); return THEN;}
"else"		{BeginToken(yytext); return ELSE;}
"elseif"	|
"else if"	{BeginToken(yytext); return ELSEIF;}
"endif"		|
"end if"	{BeginToken(yytext); return ENDIF;}

"while"		{BeginToken(yytext); return WHILE;}

"for"		{BeginToken(yytext); return FOR;}

"begin"		{BeginToken(yytext); return BEGIN;}
"end"		{BeginToken(yytext); return END;}

"var"		{BeginToken(yytext); return END;}

"wiimote"	{BeginToken(yytext); return WIIMOTE;}
"glove"		{BeginToken(yytext); return GLOVE;}

%%

//
